<template>
  <div class="rights">
    <!-- 面包屑导航 -->
    <breadcrumb firstTitle="角色列表" secondTitle="权限列表"></breadcrumb>

    <el-card>
      <el-table :data="rightList" border>
        <el-table-column type="index"></el-table-column>
        <el-table-column label="权限名称" prop="authName"></el-table-column>
        <el-table-column label="路径" prop="path"></el-table-column>
        <el-table-column label="权限等级" prop="level">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.level==='0'">等级一</el-tag>
            <el-tag type="success" v-else-if="scope.row.level==='1'">等级二</el-tag>
            <el-tag type="info" v-else>等级三</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import request from '../../network/request'
import breadcrumb from '../breadcurmb/BreakCrumb.vue'

export default {
  name: 'MyRights',
  created() {
    this.getRightList()
  },
  data() {
    return {
      rightList: [],
      levelContent: 0
    }
  },
  methods: {
    async getRightList() {
      const { data: res } = await request('rights/list')
      if (res.meta.status !== 200) {
        return this.$message.error('获取权限列表失败')
      }
      this.rightList = res.data
    }
  },
  components: {
    breadcrumb
  }
}
</script>

<style lang="less" scoped>
</style>